1. Field of the Invention
The present invention relates to a method for simultaneously loading and executing program code in a circuit system, and more particularly, to a method which utilizes a microprocessor to execute a specific code division for handling a related control operation when loading program code into a memory device.
2. Description of the Prior Art
Flash memory has been widely used in computer systems and in many portable electrical devices. Regarding the different kinds of flash memories, serial flash memory is smaller than parallel flash memory. Additionally, in the same storing density, the serial flash memory has a reduced pin count. As a result of its small size, low power consumption, and low cost of packaging, the serial flash memory can be utilized to accomplish higher-density storing mediums with lower cost so that the serial flash memory has become an ideal solution for users or designers to store data and program code in optical storing systems.
When utilizing the serial flash memory in a normal circuit system, the data and program code stored in the serial flash memory are first loaded into a DRAM, and are then executed by the related processor. Please refer to FIG. 1, which is a functional block diagram of utilizing a serial flash memory in a circuit system 10 according to a prior art. The circuit system 10 further comprises a microprocessor 12, a DRAM 16, and a loading circuit 18. In the procedure of starting the circuit system 10, the serial flash memory 14 can be used for storing a program code of the circuit system 10, and the program code can be a BIOS (basic input/output system). The BIOS comprises the drivers of devices in the circuit system 10, operating system, and basic functions related to testing and starting loaded programs to ensure that the basic devices in the circuit system 10 work properly after the circuit system starts. The microprocessor 12 can start the circuit system 10 smoothly and access the related signals of peripheral devices through this basic program code. After power is turned on and before the microprocessor starts regular operations, the loading circuit 18 loads the driving programs, testing programs, and operating system stored in the serial flash memory 14 into the DRAM 16 (in a computer system, the DRAM can be regarded as a main memory) for the microprocessor 12 to execute the program code by accessing the DRAM 16 for starting the operating system, and initializing and coordinating the operation of the devices, circuit, and peripheral devices in the circuit system 10.
In recent years, because the complexity of the related firmware is increasing, in the latest circuit systems, the BIOS and related program code are stored in flash read-only memory (flash ROM), which has a larger storing capacity. Because the flash ROM can be directly reprogrammed by the new BIOS and program code and this procedure of reprogramming is basically equivalent to the procedure of updating normal programs, the problems of replacing the hardware devices are eliminated. However, excessive loading of program code can result in substantial loading time into the DRAM 16. Furthermore, as described above, when the power of the circuit system 10 is just started and the BIOS and the related program code have to be loaded into the DRAM 16, the microprocessor 12 sometimes has to quickly respond to signals from different peripheral devices and has to simultaneously detect the capacity of DRAM 16 and the related addresses according to the loading. If every essential control operation is executed after loading all the program codes, no other operation can be executed when loading the program code so that the responding signals between peripheral devices will fail. However, if another hardware circuit is utilized to execute the related control operation, the cost is enormously increased. On the other hand, if the microprocessor 12 simultaneously accesses the uncompleted program code stored in the DRAM 16 for controlling the peripheral devices and the related signal protocols during the time when program code is being loaded into the DRAM 16, the microprocessor may possibly execute incorrect BIOS or program code so that a crash of the circuit system 10 or other errors could occur.